CREATE DATABASE eProjectDatabase
GO
USE eProjectDatabase
GO
CREATE TABLE Accounts
(
	AccID INT IDENTITY(1,1) PRIMARY KEY,
	AccUser NVARCHAR(100) NOT NULL,
	AccPass NVARCHAR(50) NOT NULL,
	AccFullName NVARCHAR(100) NOT NULL,
	AccEmail NVARCHAR(200) NOT NULL,
	AccBirthday DATETIME,
	AccPhone DECIMAL(12),
	AccisAdmin BIT DEFAULT 0,
	AccLock BIT DEFAULT 1
)
GO
CREATE TABLE Categories
(
	CatID INT IDENTITY(1,1) PRIMARY KEY,
	CatName NVARCHAR(200) NOT NULL,
	CatImg NVARCHAR(200),
	CatDesc NTEXT,
	CatLock BIT DEFAULT 0	
)
GO
CREATE TABLE Albums
(
	AlbumID INT IDENTITY(1,1) PRIMARY KEY,
	AccID INT FOREIGN KEY REFERENCES Accounts(AccID),
	CatID INT FOREIGN KEY REFERENCES Categories(CatID),
	AlbumName NVARCHAR(200) NOT NULL,
	AlbumDesc NTEXT,
	AlbumLock BIT DEFAULT 0
)
GO
CREATE TABLE Files
(
	FilesID INT IDENTITY(1,1) PRIMARY KEY,
	AlbumID INT FOREIGN KEY REFERENCES Albums(AlbumID),
	FilesName NVARCHAR(200) NOT NULL,
	FilesLink NVARCHAR(200) NOT NULL,
	FilesHtml NVARCHAR(200) NOT NULL,
	FilesDirect NVARCHAR(200) NOT NULL,
	FilesDesc NTEXT,
	FilesDateCreate DATETIME DEFAULT GETDATE(),
	FilesView INT DEFAULT 0,
	FilesLock BIT DEFAULT 0
)
GO
CREATE TABLE Comments
(
	ComID INT IDENTITY(1,1) PRIMARY KEY,
	AccID INT FOREIGN KEY REFERENCES Accounts(AccID),
	FilesID INT FOREIGN KEY REFERENCES Files(FilesID),
	ComTitle NVARCHAR(200) NOT NULL,
	ComContent NTEXT NOT NULL,
	ComDate DATETIME DEFAULT GETDATE(),
	ComLock BIT DEFAULT 0
)
GO
CREATE TABLE FAQ
(
	FAQID INT IDENTITY(1,1) PRIMARY KEY,
	AccID INT FOREIGN KEY REFERENCES Accounts(AccID),
	FAQQuestion NTEXT NOT NULL,
	FAQAnswer NTEXT,
	FAQLock BIT DEFAULT 0
)
GO
CREATE TABLE Feedbacks
(
	FBID INT IDENTITY(1,1) PRIMARY KEY,
	FBName NVARCHAR(100) NOT NULL,
	FBEmal NVARCHAR(200) NOT NULL,
	FBPhone DECIMAL(12),
	FBCompany NVARCHAR(200),
	FBContent NTEXT,
	FBDate DATETIME DEFAULT GETDATE(),
	FBLock BIT DEFAULT 0
)